<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class System extends CI_Controller {
	
	function __construct(){
		parent::__construct();
		$this->load->model('systemModel');
		$this->load->library('session');
	}

##################################################################################################
	function index(){
		
		$this->load->view('login_terminal.php');
		
		
	}
	
	
###################################################################################################
	/*this function gets a user activity description as a parameter and 
	 * store it to the databse along with the user id. If the parameter is NULL,
	 * it assumes user is just signed into the account*/	
	function footPrintLogger($activity){
		
		if($activity == NULL){
			//system requesting to insert a login activity. so this will return an access id
			$result = $this->systemModel->insert_footprint($userid,NULL,NULL);
			if($result != false){
				$this->session->set_userdata('access_id', $result);
				return true;
			}
			
			//login activity can not be inserted
			else{
				return false;
			}
		}
		
		else{
			//system requesting to insert an in-system activity
			$result = $this->systemModel->insert_footprint($userid,$accessid,$activity);
			if($result != false){
				return true;
			}
				
			//in-system activity can not be inserted
			else{
				return false;
			}
		}
	}
}
